package com.botann.projects.model;

import javax.persistence.*;
import java.util.Date;

/**
 * server-simple
 * RequestLog
 * Created by 刘山国 on 2019/10/15.
 * Copyright (c) 2017 伯坦科技. All rights reserved
 */
@Entity
@Table(name = "request_log", schema = "db_server_simple", catalog = "")
public class RequestLog {
    private long id;
    private int come;
    private boolean success;
    private int userId;
    private String user;
    private String url;
    private String parmas;
    private String hard;
    private String soft;
    private String ip;
    private String info;
    private Date requestTime;

    @Id
    @Column(name = "id", nullable = false)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "come", nullable = false)
    public int getCome() {
        return come;
    }

    public void setCome(int come) {
        this.come = come;
    }

    @Basic
    @Column(name = "success", nullable = false)
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "user", nullable = false, length = 80)
    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    @Basic
    @Column(name = "url", nullable = false, length = 255)
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Basic
    @Column(name = "parmas", nullable = true, length = -1)
    public String getParmas() {
        return parmas;
    }

    public void setParmas(String parmas) {
        this.parmas = parmas;
    }

    @Basic
    @Column(name = "hard", nullable = false, length = 64)
    public String getHard() {
        return hard;
    }

    public void setHard(String hard) {
        this.hard = hard;
    }

    @Basic
    @Column(name = "soft", nullable = false, length = 64)
    public String getSoft() {
        return soft;
    }

    public void setSoft(String soft) {
        this.soft = soft;
    }

    @Basic
    @Column(name = "ip", nullable = false, length = 255)
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Basic
    @Column(name = "info", nullable = false, length = 255)
    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    @Basic
    @Column(name = "request_time", nullable = false)
    public Date getRequestTime() {
        return requestTime;
    }

    public void setRequestTime(Date requestTime) {
        this.requestTime = requestTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RequestLog that = (RequestLog) o;

        if (id != that.id) return false;
        if (come != that.come) return false;
        if (success != that.success) return false;
        if (userId != that.userId) return false;
        if (user != null ? !user.equals(that.user) : that.user != null) return false;
        if (url != null ? !url.equals(that.url) : that.url != null) return false;
        if (parmas != null ? !parmas.equals(that.parmas) : that.parmas != null) return false;
        if (hard != null ? !hard.equals(that.hard) : that.hard != null) return false;
        if (soft != null ? !soft.equals(that.soft) : that.soft != null) return false;
        if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
        if (info != null ? !info.equals(that.info) : that.info != null) return false;
        if (requestTime != null ? !requestTime.equals(that.requestTime) : that.requestTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + come;
        result = 31 * result + (success ? 1 : 0);
        result = 31 * result + userId;
        result = 31 * result + (user != null ? user.hashCode() : 0);
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (parmas != null ? parmas.hashCode() : 0);
        result = 31 * result + (hard != null ? hard.hashCode() : 0);
        result = 31 * result + (soft != null ? soft.hashCode() : 0);
        result = 31 * result + (ip != null ? ip.hashCode() : 0);
        result = 31 * result + (info != null ? info.hashCode() : 0);
        result = 31 * result + (requestTime != null ? requestTime.hashCode() : 0);
        return result;
    }
}
